from django.contrib import admin
from django.utils.decorators import classonlymethod

from .models.products import Products, ProductType
from .models.api import HttpApi, DubboApi, ServerInfo, HostInfo


@admin.register(Products)
class ProductsAdmin(admin.ModelAdmin):
    # 显示的列
    list_display = [
        "name",
        "logo",
        "product_type",
        "description",
        "creator",
        "update_time",
        "create_time",
    ]

    #
    # def creator(self, modelMixin):
    #     return ';'.join(modelMixin.creator.all())

    # @classonlymethod
    # def administrator(cls, model_obj):
    #     print(type(model_obj))
    #     return ';'.join(model_obj.administrators.all())


@admin.register(ProductType)
class ProductTypeAdmin(admin.ModelAdmin):
    list_display = ["name", "category", "update_time", "create_time"]


# # 接口相关
# @admin.register(ServerInfo)
# class ServerInfoAdmin(admin.ModelAdmin):
#     list_display = ['name', 'describe', 'product', 'update_time', 'create_time']
#     pass
#
#
# @admin.register(HostInfo)
# class ServerInfoAdmin(admin.ModelAdmin):
#     # list_display = ['name', 'describe', 'product', 'update_time', 'create_time']
#     pass
#
#
# @admin.register(HttpApi)
# class HttpApiAdmin(admin.ModelAdmin):
#     pass
#
#
# @admin.register(DubboApi)
# class DubboApiAdmin(admin.ModelAdmin):
#     pass
#
